#ifndef WEBSOCKETCLIENTEXAMPLE_H
#define WEBSOCKETCLIENTEXAMPLE_H

#include "WWebsocketClient.h"

class WebsocketClientExample: public IWebsocketClientCb
{
public:
    WebsocketClientExample(mg_mgr *mgr = nullptr);
    virtual ~WebsocketClientExample();

    bool connect(const std::string &websocketServerUrl);
    bool sendMsg(const std::string &msg);
    void run();

    virtual void onWsClientReceiveMsg(string &msg);
    virtual void onWsClientConnected();
    virtual void onWsClientClosed();
    virtual void onWsClientError();

private:
    WWebsocketClient *_websocketClient = nullptr;
    mg_mgr *_mgr = nullptr;
};

#endif // WEBSOCKETCLIENTEXAMPLE_H
